<%@page import="com.vcs.util.VcsConstants"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<%@ page import="com.vcs.domain.*,java.util.*, com.vcs.util.VcsConstants"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Current Job Applications</title>
<script type="text/javascript">
	function PopupCenter(pageURL, title, w, h) {
		var left = (screen.width / 2) - (w / 2);
		var top = (screen.height / 2) - (h / 2);
		var targetWin = window
				.open(
						pageURL,
						title,
						'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width='
								+ w
								+ ', height='
								+ h
								+ ', top='
								+ top
								+ ', left=' + left);
	}
</script>

<script type="text/javascript">

$(document).ready(function(){
	
	$(".appRow").mouseover(function(){
		$(".appRow").css("background-color","#D1DFFE");
	});
	$(".appRow").mouseout(function(){
		$(".appRow").css("background-color","white");
	});
});
	

</script>

</head>
<body>
<h3>Current Job Applications</h3>
<hr />
<br />
<br />

<s:url namespace="/js" action="profilepopup"  var="profilePopUrl"></s:url>

<%
	if(session.getAttribute("client")!= null &&((Client)session.getAttribute("client")).getRole().equals(VcsConstants.ADMIN)){
		
	
	List<JobApplication> jobAppList = null;
	Object o = request.getAttribute("getAllJobApplications");
	if (o instanceof List) {
		jobAppList = (List<JobApplication>) o;
	}
	// sort the list by job id
	Collections.sort(jobAppList);
%>
<table border="1" width="100%" bordercolor="grey" cellspacing="0" class="test">
	<tr bgcolor="grey">
		<td>Job ID</td>
		<td>Candidate ID</td>
		<td>Application Date</td>
		<td>Profile Link</td>
	</tr>
	<%
		for (JobApplication ja : jobAppList) {
	%>
	<tr class="appRow">
		<td><%=ja.getJobId()%></td>
		<td><%=ja.getJobseekerId()%></td>
		<td><%=ja.getAppliedOnDate()%></td>
		<td>
			<a href="#" onclick="PopupCenter('${profilePopUrl}?cid=<%= ja.getJobseekerId()%>', 'Candidate Profile',500,700);">View Candidate Profile</a>
		</td>
	</tr>
	<%
		}
	}
	%>
</table>

</body>
</html>